// 获取列表信息

var model = require('../../model');
var history = model.history;
var list = model.list;

exports.getList = function getList(req, cb) {
    let query = req.query || {};
    let sort, record, page, order, skipNum;

    console.log(query);

    let q = list.find({}, '-_id');

    if (query.record) {
        q.limit(Number(query.record));
        if (query.page) {
            q.skip(Number(query.record * (query.page - 1)));
        }
    }

    if (query.order) {
        q.sort(query.order);
    }

    q.exec((err, rel) => {
        if (err) return console.log(err) && cb(err);
        return cb(null, rel);
    });
}